﻿using Microsoft.AspNetCore.Mvc;
using NFine.Data.Entity.SystemManage;
using NFine.Service.SystemManage;
using NFine.Util;
using NFine.Web.Attributes;
using NFine.Web.Controllers;

namespace NFine.Web.Areas.SystemManage.Controllers
{
    [Area("SystemManage")]
    public class UserLoginController : NFineController
    {
        private readonly UserLoginService _userLoginService;
        public UserLoginController(UserLoginService userLoginService)
        {
            _userLoginService = userLoginService;
        }

        [HttpGet]
        public IActionResult Index()
        {
            return View();
        }
        
        public IActionResult Details()
        {
            return View();
        }

        [HttpGet]
        [NFineMvcAuthorize("SystemManage_UserLogin_Index")]
        public ActionResult GetGridJson(Pagination pagination, string keyword)
        {
            var data = new
            {
                rows = _userLoginService.GetList(pagination, keyword),
                total = pagination.total,
                page = pagination.page,
                records = pagination.records
            };
            return Content(data.ToJson());
        }
    }
}